package com.tangjiali.listTopic1;

import java.util.ArrayList;
import java.util.Iterator;

public class Topic1 {
    public static void main(String[] args) {
        ArrayList<Integer> integerArrayList = new ArrayList<>();
        integerArrayList.add(0);
        integerArrayList.add(11);
        integerArrayList.add(22);
        integerArrayList.add(33);
        integerArrayList.add(44);
        System.out.println("-----------------1.自增for循环遍历-----------------");
        for (int i = 0; i < integerArrayList.size(); i++) {
            System.out.println(integerArrayList.get(i));
        }
        System.out.println("-----------------2.迭代器遍历-----------------");

        for (Iterator<Integer> iterator = integerArrayList.iterator(); iterator.hasNext(); ) {
            System.out.println(iterator.next());
        }
        System.out.println("-----------------3.增强for循环遍历-----------------");
        for (Integer integer : integerArrayList) {
            System.out.println(integer);
        }
    }
}
